-
Notifications
You must be signed in to change notification settings - Fork 37
Convert syntax file to Typescript #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert syntax file to Typescript #20
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, thank you for your hard work porting the tmLanguage file to TypeScript! This is a great contribution to the Scala community 🙏 I am unqualified to review actual changes, at a quick glance it looks great. Is there some way to validate the fidelity of this translation?
…. Updated README.
I have converted the resulting json syntax back to plist format with Also I've added pre-install and pre-package scripts and actively chicking that generated file is in place before packaging the extension. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just installed the extension locally and confirmed that it works as expected. LGTM 👍 Fantastic work @PanAeon.
To followup, I will setup CI to ensure that the typescript code continues to generate the syntax definition without errors. I will also configure the CI to automatically release a new version on tag push so that new changes get published faster to the Marketplace.
Wait, github relies on this repository having a .tmLanguage file to provide syntax highlighting for Scala on github.com (https://github.com/github/linguist/tree/master/vendor). Generating the file from a better format is great but the output still needs to be committed. |
Hmm, it seems that JSON grammars might also be accepted, but I have no idea how to test if the one added here is going to be correctly interpreted by linguist. |
I can investigate this tomorrow. There're definitely node modules that can
generate plist (tmLanguage) files.
…On Thu, 2 May 2019, 17:13 Guillaume Martres, ***@***.***> wrote:
Hmm, it seems that JSON grammars might also be accepted, but I have no
idea how to test if the one added here is going to be correctly interpreted
by linguist.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#20 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAFHP7C573Y2XO6SEF6I3NLPTMHKVANCNFSM4HJUZGYQ>
.
|
Apparently json can work but it has to be in a folder called grammars or syntaxes: https://github.com/github/linguist/blob/9116c90fcbb82ac03b4b33c58cfbde1fcf745e99/tools/grammars/compiler/loader.go#L125 |
One way to find out for sure would be to make a PR against linguist updating the vscode-scala-syntax submodule to the latest commit on master. |
This file is needed by github/linguist for syntax highlighting on github.com. Followup from comment in scala#20 (comment)
I opened #23 to unignore the Scala.tmLanguage.json file |
@smarter , |
Fixes #15
I have converted the original PLIST file with plutil to Json and then used it practically verbatim in typescript. Also I have added validation against the tmLanguage json schema from which the typescript interfaces were also generated.
I have checked the ouptut
tmLanguage.json
file, and it is identical to the original (plutil converted) json.One note is that I have added output file to the gitignore, but that means if the project hasn't been built then it is possible to package extension without the output file!
vsce package
doesn't throw any errors when file is missing, not sure if the publish process will account for this. Not sure how this can be avoided, except commiting generated file which is a bit lame.